import React, { useContext, useState, createContext } from 'react'

const Context = createContext()

function Cont() {
    const [count, setCount] = useState(10000)
    return (
        <div>
            Cont
            <Context.Provider value = { count }>
                <Father/>
            </Context.Provider>
        </div>
    )
}

function Father() {
    return (
        <div>
            Father
            <Son/>
        </div>
    )
}

function Son() {
    const count = useContext(Context)
    return (
        <div>
            Son - { count }
        </div>
    )
}


export default Cont
